#!/bin/bash

host_name=$1
host_port1=$2

for port in `seq 6061 6066`;
  do \
  mkdir -p ${port}/conf \
  && PORT=${port} envsubst < redis-cluster.tmpl > ${port}/conf/redis.conf \
  && mkdir -p ${port}/data;\
  chmod 777 ${port}/conf/redis.conf
done

docker-compose -f docker-compose.yaml stop
docker-compose -f docker-compose.yaml rm
docker-compose -f docker-compose.yaml up -d